<template>
  <div>
    <van-tabs v-model="active" @click="onClick" sticky>
      <!--<van-tab v-for="item in list" :title="item.name" :key="item.url">-->
        <!--<router-view :name="item.name"></router-view>-->
      <!--</van-tab>-->
      <van-tab title="正在热映" key="hot">
        <router-view></router-view>
      </van-tab>
      <van-tab title="即将上映" key="future">
        <router-view name="future"></router-view>
      </van-tab>
    </van-tabs>
  </div>
</template>

<script>
  import {Tab, Tabs} from 'vant'

  export default {
    name: "movies",
    components: {
      [Tab.name]: Tab,
      [Tabs.name]: Tabs
    },
    data() {
      return {
        active: 0,
        list: [{
          name: '正在热映',
          url: 'hot',
        }, {
          name: '即将上映',
          url: 'future',
        }]
      }
    },
    computed:{
      key(){
        return this.$route.params.class+new Date()
      }
    },
    methods: {
      onClick(index, title) {
        console.log(index)
      },
      getList() {

      }
    },
    mounted() {
      this.active = 0
      //this.onClick(this.active)
    }
  }
</script>

<style>
  .van-tabs__wrap--page-top{
    margin-top: 44px;
  }
</style>
